<script setup lang="ts">
import { TActivity } from "@/global";
import Taro from "@tarojs/taro";

const { merchant, source } = defineProps<{
  source: TActivity;
  merchant?: number;
}>();

const handleEvent = () => {
  Taro.navigateTo({
    url: `/packageMerchant/pages/enroll/activity?act_id=${source.id}&m_id=${merchant}`,
  });
};

const statusText = {
  // 活动状态 0 未开始 1 进行中 2 已结束
  0: "未开始",
  1: "正在进行",
  2: "已结束",
};
</script>
<template>
  <view class="rounded-[40px] bg-primary overflow-hidden"
        @tap="handleEvent">

    <view class="relative flex p-2">

      <image class="flex-none mr-1.5 w-[250px] h-[187px] rounded-[32px]"
             :src="source.title_img" />

      <view class="flex-auto text-dark">
        <view class="text-xl mt-1">{{ source.title }}</view>

        <view class="mt-0.5 text-xs">
          <view class="whitespace-pre-line">{{ source.act_time }}</view>
          <view>{{ source.address }}</view>
        </view>

        <!-- <view v-if="!merchant" class="mt-2.5 text-white text-sm">
        ¥<text class="text-xl">36</text>起
      </view> -->
      </view>

      <view class="absolute right-2.5 bottom-0 px-6 py-1 translate-y-1/2 rounded-full text-light text-sm bg-dark">
        {{ merchant ? "立即报名" : "查看详情" }}
      </view>
    </view>

    <view class="py-1 w-full px-[90px] bg-theme h-[50px]">
      <!-- <text class="text-white text-sm">
        {{ statusText[source.act_status] }}
      </text> -->
    </view>
  </view>
</template>
